   //基本信息
   function basicdata(hospitalVisit){
	var inHospitalDateTime=hospitalVisit.inHospitalDateTime;
	var outHospitalDateTime=hospitalVisit.outHospitalDateTime;
	var intime=getymd(inHospitalDateTime);
	var outtime=getymd(outHospitalDateTime);
	//获取住院天数
	var inhospitalDayNumber=Time(inHospitalDateTime,outHospitalDateTime);
	//console.log(hospitalVisit);
	$("#medicalInsuranceNumber").html(hospitalVisit.medicalInsuranceNumber);
	$("#onlyId").html(hospitalVisit.onlyId);
	$("#visitNumber").html(hospitalVisit.visitNumber);
	$("#mrId").html(hospitalVisit.mrId);
	$("#medicalPayTypeName").html(hospitalVisit.medicalPayTypeName);
	$("#patientName").html(hospitalVisit.patientName);
	$("#sexName").html(hospitalVisit.sexName);
	$("#birthday").html(hospitalVisit.birthday);
	$("#age").html(hospitalVisit.age);
	$("#marriageName").html(hospitalVisit.marriageName);
	$("#professionName").html(hospitalVisit.professionName);
	$("#birthAddress").html(hospitalVisit.birthAddress);
	$("#nationName").html(hospitalVisit.nationName);
	$("#nationalityName").html(hospitalVisit.nationalityName);
	$("#idNumber").html(hospitalVisit.idNumber);
	$("#workUnitName").html(hospitalVisit.workUnitName);
	$("#workUnitAddress").html(hospitalVisit.workUnitAddress);
	$("#workUnitPhone").html(hospitalVisit.workUnitPhone);
	$("#workUnitPostCode").html(hospitalVisit.workUnitPostCode);
	$("#permanentAddress").html(hospitalVisit.permanentAddress);
	$("#permanentAddressPostCode").html(hospitalVisit.permanentAddressPostCode);
	$("#linkManName").html(hospitalVisit.linkManName);
	$("#linkManRelativeRelationName").html(hospitalVisit.linkManRelativeRelationName);
	$("#linkManPhone").html(hospitalVisit.linkManPhone);
	$("#linkManAddress").html(hospitalVisit.linkManAddress);
	$("#inHospitalTypeName").html(hospitalVisit.inHospitalTypeName);
	$("#inHospitalStateName").html(hospitalVisit.inHospitalStateName);
	$("#clinicalReceptionDateTime").html(hospitalVisit.clinicalReceptionDateTime);
	$("#responsiblePersonName").html(hospitalVisit.responsiblePersonName);
	$("#inHospitalDateTime").html(intime);
	$("#outpatientOfDoctorName").html(hospitalVisit.outpatientOfDoctorName)
	$("#inDeptName").html(hospitalVisit.inDeptName);
	$("#outHospitalDateTime").html(outtime);
	$("#outDeptName").html(hospitalVisit.outDeptName);
	
	$("#personnelCategoryName").html(hospitalVisit.personnelCategoryName);
	$("#majorUnitName").html(hospitalVisit.majorUnitName);
	$("#troopServiceName").html(hospitalVisit.troopServiceName);
	$("#medicalSystemName").html(hospitalVisit.medicalSystemName);
	$("#idTypeName").html(hospitalVisit.idTypeName);
	$("#costTypeName").html(hospitalVisit.costTypeName);
	$("#jobStateName").html(hospitalVisit.jobStateName);
	$("#militaryTrainingInjuryName").html(hospitalVisit.militaryTrainingInjuryName);
	
	$("#diagConfirmedDateTime").html(hospitalVisit.diagConfirmedDateTime);
	//住院天数
	if(hospitalVisit.inHospitalDayNumber){
		$("#inHospitalDayNumber").html(hospitalVisit.inHospitalDayNumber);
	}else{
		$("#inHospitalDayNumber").html(inhospitalDayNumber);
	}
	//确诊时间
	var diagConfirmedDayNumber=Time(hospitalVisit.clinicalReceptionDateTime,hospitalVisit.diagConfirmedDateTime);
	if(hospitalVisit.diagConfirmedDayNumber){
		$("#diagConfirmedDayNumber").html(hospitalVisit.diagConfirmedDayNumber);
	}else{
		$("#diagConfirmedDayNumber").html(diagConfirmedDayNumber);
	}
	//是否尸检
	$("#autopsyCode").html(hospitalVisit.autopsyCode)
 }
    //计算出院和入院日期
	function getymd(dateStr) {
		if(dateStr=="" || dateStr==undefined){
			return "";
		}
	     var date = new Date(Date.parse(dateStr.replace(/-/g, "/")));
	     var mm = date.getMonth() + 1;
	     //月
	    var dd = date.getDate();
	     //日
	    var yy = date.getFullYear();
	     //年
	    var h = date.getHours(); 
	   	return yy+"年"+mm+"月"+dd+"日&nbsp;"+h+"时";
	 } 
	//计算出院和入院日期之差
	function Time(inTime,outTime){
		if(inTime=="" || inTime==undefined||outTime==""||outTime==undefined){
			return "";
		}
	     var indate = new Date(Date.parse(inTime.replace(/-/g, "/")));
	     var outdate = new Date(Date.parse(outTime.replace(/-/g, "/")));
	     var ss=(outdate.getTime()-indate.getTime());
	     return Math.ceil(ss/(24*3600*1000));
	}
	//病案首页出院诊断
	function diseaseDiagRecords(data){
		var diseaseDiagRecords=data.diseaseDiagRecords;
		
		var otherdiseaseDiagHtml="";
		var num=0;
		var hospitaldiseaseDiagHtml="";
		for(var index in diseaseDiagRecords){
			
			var diseaseDiagRecord=diseaseDiagRecords[index];
			if(diseaseDiagRecord.confirmedDateTime=="" || diseaseDiagRecord.confirmedDateTime==null){
				diseaseDiagRecord.confirmedDateTime="";
			}
			//diseaseDiagCode=1是门诊诊断，2是入院初诊，3是主要诊断，A是其他诊断，8是病理诊断，6是院内感染，7是损伤和中毒原因，9根本死亡原因，4并发症，5非并发症
			//门诊诊断
			if(diseaseDiagRecord.diagTypeCode==1){
				//console.log(diseaseDiagRecord.diseaseDiagName)
				$("#diseaseDiagName0").html(diseaseDiagRecord.diseaseDiagName);
				$("#diseaseDiagCode0").html(diseaseDiagRecord.diseaseDiagCode);
			}
			//入院初诊
			if(diseaseDiagRecord.diagTypeCode==2){
				$("#diseaseDiagName2").html(diseaseDiagRecord.diseaseDiagName);
				$("#diseaseDiagCode2").html(diseaseDiagRecord.diseaseDiagCode);
			}
			//主要诊断
			if(diseaseDiagRecord.diagTypeCode==3){
				$("#diseaseDiagName1").html(diseaseDiagRecord.diseaseDiagName);
				$("#confirmedDateTime1").html(diseaseDiagRecord.confirmedDateTime.substring(0,10));
				$("#treatResultName1").html(diseaseDiagRecord.treatResultName);
				$("#treatDayNumber1").html(diseaseDiagRecord.treatDayNumber);
				$("#diseaseDiagCode1").html(diseaseDiagRecord.diseaseDiagCode);
			}
			//其他诊断
			if(diseaseDiagRecord.diagTypeCode=="A"){
				num+=1
			    if(num==1){
					otherdiseaseDiagHtml=otherdiseaseDiagHtml+"<tr>"+
						"<td>"+
							"<label style='width: 320px;'>其他诊断&nbsp;<span>"+diseaseDiagRecord.diseaseDiagName+"</span></label>"+
						"</td>"+
						"<td width='90' align='center'>"+
							"<label style='width: 79px;'><span>"+diseaseDiagRecord.confirmedDateTime.substring(0,10)+"</span></label>"+
						"</td>"+
						"<td width='22'>"+
							"<label style='width: 35px;'><span>"+diseaseDiagRecord.treatResultName+"</span></label>"+
						"</td>"+
						"<td width='22' align='center'>"+
							"<label style='width: 35px;'><span>"+diseaseDiagRecord.treatDayNumber+"</span></label>"+
						"</td>"+
						"<td width='70' align='center'>"+
							"<label style='width: 60px;'><span>"+diseaseDiagRecord.diseaseDiagCode+"</span></label>"+
						"</td>"+
					"</tr>";
				}else if(num>6){
					continue;
				}else{
					otherdiseaseDiagHtml=otherdiseaseDiagHtml+"<tr>"+
						"<td>"+
							"<label style='width: 320px;'>&emsp;&emsp;&emsp;&emsp;&nbsp;<span id=''>"+diseaseDiagRecord.diseaseDiagName+"</span></label>"+
						"</td>"+
						"<td align='center'>"+
							"<label style='width: 79px;'><span id=''>"+diseaseDiagRecord.confirmedDateTime.substring(0,10)+"</span></label>"+
						"</td>"+
						"<td>"+
							"<label style='width: 35px;'><span id=''>"+diseaseDiagRecord.treatResultName+"</span></label>"+
						"</td>"+
						"<td align='center'>"+
							"<label style='width: 35px;'><span id=''>"+diseaseDiagRecord.treatDayNumber+"</span></label>"+
						"</td>"+
						"<td align='center'>"+
							"<label style='width: 60px;'><span id=''>"+diseaseDiagRecord.diseaseDiagCode+"</span></label>"+
						"</td>"+
					"</tr>";
				}
			}
			//医院感染
			
			if(diseaseDiagRecord.diagTypeCode==6){
				if(diseaseDiagRecord.diagSortIndex== 1){
					hospitaldiseaseDiagHtml=hospitaldiseaseDiagHtml+"<tr>"+
						"<td>"+
							"<label style='width: 320px;'>医院感染名称&nbsp;<span>"+diseaseDiagRecord.diseaseDiagName+"</span></label>"+
						"</td>"+
						"<td width='90' align='center'>"+
							"<label style='width: 79px;'><span>"+diseaseDiagRecord.confirmedDateTime.substring(0,10)+"</span></label>"+
						"</td>"+
						"<td width='22'>"+
							"<label style='width: 35px;'><span>"+diseaseDiagRecord.treatResultName+"</span></label>"+
						"</td>"+
						"<td width='22' align='center'>"+
							"<label style='width: 35px;'><span>"+diseaseDiagRecord.treatDayNumber+"</span></label>"+
						"</td>"+
						"<td width='70' align='center'>"+
							"<label style='width: 60px;'><span>"+diseaseDiagRecord.diseaseDiagCode+"</span></label>"+
						"</td>"+
					"</tr>";
				}else{
					hospitaldiseaseDiagHtml=hospitaldiseaseDiagHtml+"<tr>"+
						"<td>"+
							"<label style='width: 320px;'>&emsp;&emsp;&emsp;&emsp;&nbsp;<span id=''>"+diseaseDiagRecord.diseaseDiagName+"</span></label>"+
						"</td>"+
						"<td align='center'>"+
							"<label style='width: 79px;'><span id=''>"+diseaseDiagRecord.confirmedDateTime.substring(0,10)+"</span></label>"+
						"</td>"+
						"<td>"+
							"<label style='width: 35px;'><span id=''>"+diseaseDiagRecord.treatResultName+"</span></label>"+
						"</td>"+
						"<td align='center'>"+
							"<label style='width: 35px;'><span id=''>"+diseaseDiagRecord.treatDayNumber+"</span></label>"+
						"</td>"+
						"<td align='center'>"+
							"<label style='width: 60px;'><span id=''>"+diseaseDiagRecord.diseaseDiagCode+"</span></label>"+
						"</td>"+
					"</tr>";
				}
			}
			//病理诊断
			if(diseaseDiagRecord.diagTypeCode==8){
				$("#dis_diseaseDiagName").html(diseaseDiagRecord.diseaseDiagName);
				$("#dis_diseaseDiagCode").html(diseaseDiagRecord.diseaseDiagCode);
			}
			//损伤、中毒的外部原因pos_diseaseDiagName
			if(diseaseDiagRecord.diagTypeCode==7){
				$("#pos_diseaseDiagName").html(diseaseDiagRecord.diseaseDiagName);
				$("#pos_diseaseDiagCode").html(diseaseDiagRecord.diseaseDiagCode);
			}
			//根本死亡原因
			if(diseaseDiagRecord.diagTypeCode==9){
				$("#die_diseaseDiagName").html(diseaseDiagRecord.diseaseDiagName);
				$("#die_diseaseDiagCode").html(diseaseDiagRecord.diseaseDiagCode);
			}
		}
		var emptyhtml="<tr>"+
		"<td>"+
		"<label style='width: 320px;'>&emsp;&emsp;&emsp;&emsp;&nbsp;<span></span></label>"+
	    "</td>"+
		"<td width='90' align='center'>"+
			"<label style='width: 79px;'><span></span></label>"+
		"</td>"+
		"<td width='22'>"+
			"<label style='width: 35px;'><span></span></label>"+
		"</td>"+
		"<td width='22' align='center'>"+
			"<label style='width: 35px;'><span></span></label>"+
		"</td>"+
		"<td width='70' align='center'>"+
			"<label style='width: 60px;'><span></span></label>"+
		"</td>"+
	    "</tr>";
		if(otherdiseaseDiagHtml==""){
			otherdiseaseDiagHtml=otherdiseaseDiagHtml+"<tr>"+
			"<td>"+
			"<label style='width: 320px;'>其他诊断&nbsp;<span></span></label>"+
		    "</td>"+
			"<td width='90' align='center'>"+
				"<label style='width: 79px;'><span></span></label>"+
			"</td>"+
			"<td width='22'>"+
				"<label style='width: 35px;'><span></span></label>"+
			"</td>"+
			"<td width='22' align='center'>"+
				"<label style='width: 35px;'><span></span></label>"+
			"</td>"+
			"<td width='70' align='center'>"+
				"<label style='width: 60px;'><span></span></label>"+
			"</td>"+
		    "</tr>";
		}
		
		if(hospitaldiseaseDiagHtml==""){
			hospitaldiseaseDiagHtml=hospitaldiseaseDiagHtml+"<tr>"+
			"<td>"+
				"<label style='width: 320px;'>医院感染名称&nbsp;<span></span></label>"+
			"</td>"+
			"<td width='90' align='center'>"+
				"<label style='width: 79px;'><span></span></label>"+
			"</td>"+
			"<td width='22'>"+
				"<label style='width: 35px;'><span></span></label>"+
			"</td>"+
			"<td width='22' align='center'>"+
				"<label style='width: 35px;'><span></span></label>"+
			"</td>"+
			"<td width='70' align='center'>"+
				"<label style='width: 60px;'><span></span></label>"+
			"</td>"+
		"</tr>";
		}
		$("#otherdiseaseDiag").html(otherdiseaseDiagHtml);
		$("#hospitaldiseaseDiag").html(hospitaldiseaseDiagHtml);
		//其他诊断保持6行
		var l=6-$("#otherdiseaseDiag tr").length;
		while(l>0&&l<=6){
			l--;
			$("#otherdiseaseDiag").after(emptyhtml);
		}
	}
	//病案首页手术操作
	function operateInfo(data){
		var operateRecords=data;
		var operatehtml="";
		for(var index in operateRecords){
			var operateRecord=operateRecords[index];
			var operateWorker=operateRecord.operateWorkers[index];
			if(operateRecord.operateStartDate=="" || operateRecord.operateStartDate==null){
				operateRecord.operateStartDate="";
			}
			operatehtml=operatehtml+"<tr>"+
						"<td style='height: 40px' align='center'>"+
						"<label><span id=''>"+operateRecord.operateStartDate.substring(0,10)+"</span></label>"+
						"</td>"+
						"<td style='height: 40px' align='center'>"+
							"<label><span id=''>"+(operateRecord.operateName?operateRecord.operateName:"")+"</span></label>"+
						"</td>"+
						"<td style='height: 40px' align='center'>"+
							"<label><span id=''>"+(operateRecord.operateWorkers[0].medicalWorkerName?operateRecord.operateWorkers[0].medicalWorkerName:"")+"</span></label>"+
						"</td>"+
						"<td style='height: 40px' align='center'>"+
							"<label><span id=''>"+(operateRecord.operateWorkers[1].medicalWorkerName?operateRecord.operateWorkers[1].medicalWorkerName:"")+"</span></label>"+
						"</td>"+
						"<td style='height: 40px' align='center'>"+
							"<label><span id=''>"+(operateRecord.operateWorkers[2].medicalWorkerName?operateRecord.operateWorkers[2].medicalWorkerName:"")+"</span></label>"+
						"</td>"+
						"<td style='height: 40px' align='center'>"+
							"<label><span id=''>"+(operateRecord.anaesthesiaTypeName?operateRecord.anaesthesiaTypeName:"")+"</span></label>"+
						"</td>"+
						"<td style='height: 40px' align='center'>"+
							"<label><span id=''>"+(operateRecord.incisionLevelNames?operateRecord.incisionLevelNames:"")+"</span></label>"+
						"</td>"+
						"<td style='height: 40px' align='center'>"+
							"<label><span id=''>"+(operateRecord.operateWorkers[3].medicalWorkerName?operateRecord.operateWorkers[3].medicalWorkerName:"")+"</span></label>"+
						"</td>"+
						"<td style='height: 40px' align='center'>"+
							"<label><span id=''>"+(operateRecord.operateCode?operateRecord.operateCode:"")+"</span></label>"+
						"</td>"+
					 "</tr>";
		}
		$("#operateRecords").html(operatehtml);
		//手术操作保持6行
		var l=6-$("#operateRecords tr").length;
		while(l>0&&l<=6){
			l--;
			$("#operateRecords").after($("#operate_tr").clone(true));
		}
	}

	//诊断符合情况
	function diagAccordRecords(data){
		var diags=data.diagAccordRecords;
		for(var index in diags){
			var diag = diags[index];
			if( diag.diagCompareName.indexOf("门诊诊断与出院诊断") >=0){
				if(diag.diagAccordCode==4){
					diag.diagAccordCode=0;
				}
				$("#accord0").html(diag.diagAccordCode);
			}
			if(diag.diagCompareName.indexOf("入院诊断与出院诊断") >=0){
				if(diag.diagAccordCode==4){
					diag.diagAccordCode=0;
				}
				$("#accord1").html(diag.diagAccordCode);
			}
			if( diag.diagCompareName.indexOf("术前诊断与术后诊断") >=0){
				if(diag.diagAccordCode==4){
					diag.diagAccordCode=0;
				}
				$("#accord2").html(diag.diagAccordCode);
			}
			if( diag.diagCompareName.indexOf("临床诊断与病理诊断") >=0){
				if(diag.diagAccordCode==4){
					diag.diagAccordCode=0;
				}
				$("#accord3").html(diag.diagAccordCode);
			}
			if( diag.diagCompareName.indexOf("放射诊断与病理诊断") >=0){
				if(diag.diagAccordCode==4){
					diag.diagAccordCode=0;
				}
				$("#accord4").html(diag.diagAccordCode);
			}
		
		}
	}

	//住院期间 发生
	function inhospitalInfo(cureInfo,nurseInfo,intensiveCareInfo,pressureSoreInfo){
		$("#rescueNumber").html(cureInfo.rescueNumber);
		$("#rescueSucceedNumber").html(cureInfo.rescueSucceedNumber);
		$("#icuNurseDayNumber").html(intensiveCareInfo.icuNurseDayNumber);
		$("#ccuNurseDayNumber").html(intensiveCareInfo.ccuNurseDayNumber);
		$("#criticalDayNumber").html(nurseInfo.criticalDayNumber);
		$("#sickDayNumber").html(nurseInfo.sickDayNumber);
		$("#specialNurseDayNumber").html(nurseInfo.specialNurseDayNumber);
		$("#firstLevelNurseDayNumber").html(nurseInfo.firstLevelNurseDayNumber);
		$("#secondLevelNurseDayNumber").html(nurseInfo.secondLevelNurseDayNumber);
		$("#pressureSoreTimes").html(pressureSoreInfo.pressureSoreTimes);
		//药物过敏
		$("#hbsAgeResultCode").html(cureInfo.hbsAgeResultCode);
		$("#hcvAbResultCode").html(cureInfo.hcvAbResultCode);
		$("#hivAbResultCode").html(cureInfo.hivAbResultCode);
		//随诊
		if(cureInfo.followUpClinicLimitName=="否"){
			cureInfo.followUpClinicLimitCode=2;
		}
		$("#followUpClinicLimitCode").html(cureInfo.followUpClinicLimitCode);
		var followUpClinicWeekNumber,followUpClinicMonthNumber,followUpClinicYearNumber;
		if(cureInfo.followUpClinicDayNumber>0&&cureInfo.followUpClinicDayNumber<30){
			followUpClinicWeekNumber=Math.ceil(cureInfo.followUpClinicDayNumber/7);
		}
		if(cureInfo.followUpClinicDayNumber<365&&cureInfo.followUpClinicDayNumber>=30){
			followUpClinicMonthNumber=Math.ceil(cureInfo.followUpClinicDayNumber/30);
		}
		if(cureInfo.followUpClinicDayNumber>365){
			followUpClinicYearNumber=Math.ceil(cureInfo.followUpClinicDayNumber/365);
		}
		$("#followUpClinicWeekNumber").html(followUpClinicWeekNumber);
		$("#followUpClinicMonthNumber").html(followUpClinicMonthNumber);
		$("#followUpClinicYearNumber").html(followUpClinicYearNumber);
		//血型
		$("#bloodTypeCode").html(cureInfo.bloodTypeCode);
		$("#rhBloodTypeCode").html(cureInfo.rhBloodTypeCode);
	}
    
	//输血品种：
	function infusionBloodInfo(data){
		$("#infusionBloodTimes").html(data.infusionBloodTimes);
		$("#infusionBloodReactTimes").html(data.infusionBloodReactTimes);
		var infusionBloodRecords=data.infusionBloodRecords;
		var blood1=blood2=blood3=blood4=blood5=blood6=0;
		var blood7=false;
		var totleblood=0;
		for(var k in infusionBloodRecords){
			var infusionBloodRecord=infusionBloodRecords[k];
			var infusionBlood=infusionBloodRecord.bloodElements;
			if(infusionBlood){
				for(var index in infusionBlood){
					var Blood=infusionBlood[index];
					if(Blood.bloodElementName.indexOf("红细胞")>=0){
						blood1+=Number(Blood.bloodElementVolume);
						totleblood+=Number(Blood.bloodElementVolume);
					}
					if(Blood.bloodElementName.indexOf("血浆")>=0){
						blood2+=Number(Blood.bloodElementVolume);
						totleblood+=Number(Blood.bloodElementVolume);
					}
					if(Blood.bloodElementName.indexOf("血小板")>=0){
					    blood3+=Number(Blood.bloodElementVolume);
					    totleblood+=Number(Blood.bloodElementVolume);
					}
					if(Blood.bloodElementName.indexOf("全血")>=0){
						blood5+=Number(Blood.bloodElementVolume);
						totleblood+=Number(Blood.bloodElementVolume);
					}
					if(Blood.bloodElementName.indexOf("其他")>=0){
						blood6+=Number(Blood.bloodElementVolume);
						//totleblood+=Number(Blood.bloodElementVolume);
					}
					if(Blood.bloodElementName.indexOf("自体血")>=0){
						blood7=true;	
						totleblood+=Number(Blood.bloodElementVolume);
					}
				}
			}
		}
		$("#blood1").html(blood1);
		$("#blood2").html(blood2);
		$("#blood3").html(blood3);
		$("#blood5").html(blood5);
		$("#blood6").html(blood6);
		if(blood7){
			$("#blood7").html("1");
		}else{
			$("#blood7").html("2");
		}
		if(data.infusionBloodTotalVolume){
			$("#infusionBloodTotalVolume").html(data.infusionBloodTotalVolume);
		}else{
			$("#infusionBloodTotalVolume").html(totleblood);
		}
	}
	//住院费用
	function costRecords(data){
		var costs=data.costRecords;
		var money=0;
		for(var index in costs){
			var cost=costs[index];
			if(cost.medicalCostTypeName.indexOf("床位")>=0){
				$("#costMoney1").html(cost.costMoney);
				money=money+cost.costMoney;
				continue;
			}
			if(cost.medicalCostTypeName.indexOf("西药")>=0){
				$("#costMoney2").html(cost.costMoney);
				money=money+cost.costMoney;
				continue;
			}
			if(cost.medicalCostTypeName.indexOf("中药")>=0){
				$("#costMoney3").html(cost.costMoney);
				money=money+cost.costMoney;
				continue;
			}
			if(cost.medicalCostTypeName.indexOf("检验")>=0){
				$("#costMoney4").html(cost.costMoney);
				money=money+cost.costMoney;
				continue;
			}
			if(cost.medicalCostTypeName.indexOf("放射")>=0){
				$("#costMoney5").html(cost.costMoney);
				money=money+cost.costMoney;
				continue;
			}
			if(cost.medicalCostTypeName.indexOf("特检")>=0){
				$("#costMoney6").html(cost.costMoney);
				money=money+cost.costMoney;
				continue;
			}
			if(cost.medicalCostTypeName.indexOf("治疗")>=0){
				$("#costMoney7").html(cost.costMoney);
				money=money+cost.costMoney;
				continue;
			}
			if(cost.medicalCostTypeName.indexOf("输血")>=0){
				$("#costMoney8").html(cost.costMoney);
				money=money+cost.costMoney;
				continue;
			}
			if(cost.medicalCostTypeName.indexOf("手术")>=0){
				$("#costMoney9").html(cost.costMoney);
				money=money+cost.costMoney;
				continue;
			}
			if(cost.medicalCostTypeName.indexOf("护理")>=0){
				$("#costMoney10").html(cost.costMoney);
				money=money+cost.costMoney;
				continue;
			}
			if(cost.medicalCostTypeName.indexOf("其他")>=0){
				$("#costMoney11").html(cost.costMoney);
				money=money+cost.costMoney;
				continue;
			}
		}
		$("#totalCost").html(data.totalCost);
	}
	//医护工作者
	function cureWorkers(cureInfo){
		var cureWorkers=cureInfo.cureWorkers;
		var medicalWorkerName="";
		for(var index in cureWorkers){
			var cureWorker=cureWorkers[index];
			//科主任
			if(cureWorker.professionTitleCode=="Y00"){
				$("#cureWorkers0").html(cureWorker.medicalWorkerName);
			}
			//主任医师
			
			if(cureWorker.professionTitleCode=="Y01"){
				medicalWorkerName+=cureWorker.medicalWorkerName;
			}
			//副主任医师
			if(cureWorker.professionTitleCode=="Y02"){
				medicalWorkerName+=cureWorker.medicalWorkerName;
			}
			
			//主治医师
			if(cureWorker.professionTitleCode=="Y03"){
				$("#cureWorkers2").html(cureWorker.medicalWorkerName);
			}
			//住院医师
			if(cureWorker.professionTitleCode=="Y10"){
				$("#cureWorkers3").html(cureWorker.medicalWorkerName);
			}
			//进修医师
			if(cureWorker.professionTitleCode=="Y04"){
				$("#cureWorkers4").html(cureWorker.medicalWorkerName);
			}
			//研究生实习医师
			if(cureWorker.professionTitleCode=="Y05"){
				$("#cureWorkers5").html(cureWorker.medicalWorkerName);
			}
			//实习医师
			if(cureWorker.professionTitleCode=="Y06"){
				$("#cureWorkers6").html(cureWorker.medicalWorkerName);
			}
			//编码员
			if(cureWorker.professionTitleCode=="Y07"){
				$("#cureWorkers7").html(cureWorker.medicalWorkerName);
			}
			//质控医师
			if(cureWorker.professionTitleCode=="Y08"){
				$("#cureWorkers8").html(cureWorker.medicalWorkerName);
			}
			//质控护士
			if(cureWorker.professionTitleCode=="Y09"){
				$("#cureWorkers9").html(cureWorker.medicalWorkerName);
			}
		}
		//主(副)主任医师
		$("#cureWorkers1").html(medicalWorkerName);
		//病案质量
		$("#medicalRecordQualityName").html(cureInfo.medicalRecordQualityName);
		$("#qualityControlDateTime").html(cureInfo.qualityControlDateTime);
	}
	
    function examinationReportsInfo(data){
		var examinationReportsRecord=data.examinationReportsRecords;
		var html="<tr>"+
						"<td style='width: 244px;border: none;padding-left: 15px;'>"+
							"<label style='width: 240px;'>姓&nbsp;名:<span>"+examinationReportsRecord[0].patientName+"</span></label>"+
							"<label style='width: 240px;'>性&nbsp;别:<span>"+examinationReportsRecord[0].sexName+"</span></label>"+
							"<label style='width: 240px;'>年&nbsp;龄:<span>"+examinationReportsRecord[0].ageName+"</span></label>"+
							"<label style='width: 240px;'>病&nbsp;案:<span>"+examinationReportsRecord[0].mrId+"</span></label>"+
						"</td>"+
						"<td style='width: 244px;border: none;'>"+
							"<label style='width: 250px;'>科&nbsp;别:<span>"+examinationReportsRecord[0].deptCategoryName+"</span></label>"+
							"<label style='width: 250px;'>床&nbsp;位:<span>"+examinationReportsRecord[0].bedName+"</span></label>"+
							"<label style='width: 250px;'>费&nbsp;别:<span>"+examinationReportsRecord[0].costName+"</span></label>"+
							"<label style='width: 250px;'>送检医师:<span>"+examinationReportsRecord[0].submittingPhysicianName+"</span></label>"+
						"</td>"+
						"<td style='width: 244px;border: none;'>"+
							"<label style='width: 240px;'>样本编号<span>"+examinationReportsRecord[0].specimenCode+"</span></label>"+
							"<label style='width: 240px;'>条码编号:<span>"+examinationReportsRecord[0].barCode+"</span></label>"+
							"<label style='width: 240px;'>标本种类:<span>"+examinationReportsRecord[0].specimenTypeName+"</span></label>"+
							"<label style='width: 240px;'>临床诊断:<span>"+examinationReportsRecord[0].clinicalDiagnosisName+"</span></label>"+
						"</td>"+
					"</tr>";
		$("#examinationReportstitle").html(html);
		
	}
	//检验报告单
	function addReportsRecord(reportsInfo){
		var reportsRecords=reportsInfo.examinationReportsRecords;
		for(var index in reportsRecords){
			var reportsRecord=reportsRecords[index];
			var add_content=$("#reportsRecordTemplate").clone();
			add_content.removeAttr("id");
			add_content.find(".patientName").html(reportsRecord.patientName);
			add_content.find(".sexName").html(reportsRecord.sexName);
			add_content.find(".ageName").html(reportsRecord.ageName);
			add_content.find(".mrId").html(reportsRecord.mrId);
			add_content.find(".deptCategoryName").html(reportsRecord.deptCategoryName);
			add_content.find(".bedName").html(reportsRecord.bedName);
			add_content.find(".costName").html(reportsRecord.costName);
			add_content.find(".submittingPhysicianName").html(reportsRecord.submittingPhysicianName);
			add_content.find(".specimenCode").html(reportsRecord.specimenCode);
			add_content.find(".barCode").html(reportsRecord.barCode);
			add_content.find(".specimenTypeName").html(reportsRecord.specimenTypeName);
			add_content.find(".clinicalDiagnosisName").html(reportsRecord.clinicalDiagnosisName);
			add_content.find(".samplingDateTime").html(reportsRecord.samplingDateTime);
			add_content.find(".inspectDateTime").html(reportsRecord.inspectDateTime);
			add_content.find(".inspectionDoctorName").html(reportsRecord.inspectionDoctorName);
			add_content.find(".acceptanceCheckDateTime").html(reportsRecord.acceptanceCheckDateTime);
			add_content.find(".reportDateTime").html(reportsRecord.reportDateTime);
			add_content.find(".auditorDoctorName").html(reportsRecord.auditorDoctorName);
			add_content.find(".remark").html(reportsRecord.remark);
			add_content.removeAttr("hidden");
			var reportItems=reportsRecord.examinationReportsItems;
			var reportsRecordTable= add_content.find("#reportsRecordTableTemplate");
		    reportsRecordTable.removeAttr("id");
		    var itemCount=0;
			for(var itemIndex in reportItems){
				var reportItem=reportItems[itemIndex];
				itemCount++;
			    var addItem = reportsRecordTable.find("#reportItemTrTemplate").clone();
			    addItem.removeAttr("id");
			    addItem.removeAttr("hidden");
			    addItem.find(".index").html(itemCount);
			    addItem.find(".projectName").html(reportItem.projectName);
			    addItem.find(".examinationResult").html(reportItem.examinationResult);
			    addItem.find(".examinationUnit").html(reportItem.examinationUnit);
			    addItem.find(".referenceValues").html(reportItem.referenceValues);
			    
			   reportsRecordTable.find("#reportsRecordsTbody").append(addItem);
			}
			
		   
			$("#reportsRecords").append(add_content);
		}
		
	}

	//临时医嘱单
	function doctorAdviceTemporaryInfo(data){
		//console.log(data);
		var doctorAdviceTemporaryRecords=data.doctorAdviceTemporaryRecords;
		var num=0;//页数
		for(var index in doctorAdviceTemporaryRecords){
			var listLength=doctorAdviceTemporaryRecords[index].doctorAdviceTemporaryItems.length;//获取数据条数
			var pageNum=Math.ceil(listLength/20);//获取页数
			var numBer=0;//数组下标值
			if(pageNum>1){
				for (var int = 0; int < pageNum; int++) {//循环页数
					num++;
					var doctorAdviceTemporaryRecord=doctorAdviceTemporaryRecords[index];
					var doctorAdviceTemporaryModel=$("#doctorAdviceTemporaryModel").clone();
					doctorAdviceTemporaryModel.removeAttr("id");
					doctorAdviceTemporaryModel.removeAttr("hidden");
					doctorAdviceTemporaryModel.find(".patientId").html(doctorAdviceTemporaryRecord.patientId);
					doctorAdviceTemporaryModel.find(".patientName").html(doctorAdviceTemporaryRecord.patientName);
					doctorAdviceTemporaryModel.find(".deptName").html(doctorAdviceTemporaryRecord.deptName);
					doctorAdviceTemporaryModel.find(".bedName").html(doctorAdviceTemporaryRecord.bedName);
					doctorAdviceTemporaryModel.find(".mrId").html(doctorAdviceTemporaryRecord.mrId);
					doctorAdviceTemporaryModel.find(".indexNumber").html(num);
					var doctorAdviceTemporaryItems=doctorAdviceTemporaryRecord.doctorAdviceTemporaryItems;
					var doctorAdviceTemporaryTable=doctorAdviceTemporaryModel.find("#doctorAdviceTemporaryTable");
					doctorAdviceTemporaryTable.removeAttr("id");
					for(var itemsIndex in doctorAdviceTemporaryItems){
						if(numBer==listLength){
							break;
						}
						var doctorAdviceTemporaryItem=doctorAdviceTemporaryItems[numBer];
						var doctorAdviceContent=doctorAdviceTemporaryTable.find("#doctorAdviceContent").clone();
						doctorAdviceContent.removeAttr("hidden");
						doctorAdviceContent.removeAttr("id");
						if(doctorAdviceTemporaryItem.presupposeDateTime==""||doctorAdviceTemporaryItem.presupposeDateTime==null){
							doctorAdviceTemporaryItem.presupposeDateTime="";
						}
						if(doctorAdviceTemporaryItem.executionDateTime==""||doctorAdviceTemporaryItem.executionDateTime==null){
							doctorAdviceTemporaryItem.executionDateTime="";
						}
						doctorAdviceContent.find(".presupposeDateTimeymd").html(doctorAdviceTemporaryItem.presupposeDateTime.substring(2,10));
						doctorAdviceContent.find(".presupposeDateTimehms").html(doctorAdviceTemporaryItem.presupposeDateTime.substring(11,16));
						doctorAdviceContent.find(".doctorAdviceContent").html(doctorAdviceTemporaryItem.doctorAdviceContent);
						doctorAdviceContent.find(".doctorName").html(doctorAdviceTemporaryItem.doctorName);
						doctorAdviceContent.find(".nurseName").html(doctorAdviceTemporaryItem.nurseName);
						doctorAdviceContent.find(".executionDateTime").html(doctorAdviceTemporaryItem.executionDateTime.substring(12,16));
						doctorAdviceTemporaryTable.find("#doctorAdviceTemporaryInfoTbody").append(doctorAdviceContent);
						numBer++;
						if(numBer%20==0){//当下表值达到20的倍数会自动分到下一页
							break;
						}
					}
					
					$("#doctorAdviceTemporaryInfo").append(doctorAdviceTemporaryModel);
				}
			}else{
				num++;
				var doctorAdviceTemporaryRecord=doctorAdviceTemporaryRecords[index];
				var doctorAdviceTemporaryModel=$("#doctorAdviceTemporaryModel").clone();
				doctorAdviceTemporaryModel.removeAttr("id");
				doctorAdviceTemporaryModel.removeAttr("hidden");
				doctorAdviceTemporaryModel.find(".patientId").html(doctorAdviceTemporaryRecord.patientId);
				doctorAdviceTemporaryModel.find(".patientName").html(doctorAdviceTemporaryRecord.patientName);
				doctorAdviceTemporaryModel.find(".deptName").html(doctorAdviceTemporaryRecord.deptName);
				doctorAdviceTemporaryModel.find(".bedName").html(doctorAdviceTemporaryRecord.bedName);
				doctorAdviceTemporaryModel.find(".mrId").html(doctorAdviceTemporaryRecord.mrId);
				doctorAdviceTemporaryModel.find(".indexNumber").html(num);
				var doctorAdviceTemporaryItems=doctorAdviceTemporaryRecord.doctorAdviceTemporaryItems;
				var doctorAdviceTemporaryTable=doctorAdviceTemporaryModel.find("#doctorAdviceTemporaryTable");
				doctorAdviceTemporaryTable.removeAttr("id");
				for(var itemsIndex in doctorAdviceTemporaryItems){
					var doctorAdviceTemporaryItem=doctorAdviceTemporaryItems[itemsIndex];
					var doctorAdviceContent=doctorAdviceTemporaryTable.find("#doctorAdviceContent").clone();
					doctorAdviceContent.removeAttr("hidden");
					doctorAdviceContent.removeAttr("id");
					if(doctorAdviceTemporaryItem.presupposeDateTime==""||doctorAdviceTemporaryItem.presupposeDateTime==null){
						doctorAdviceTemporaryItem.presupposeDateTime="";
					}
					if(doctorAdviceTemporaryItem.executionDateTime==""||doctorAdviceTemporaryItem.executionDateTime==null){
						doctorAdviceTemporaryItem.executionDateTime="";
					}
					doctorAdviceContent.find(".presupposeDateTimeymd").html(doctorAdviceTemporaryItem.presupposeDateTime.substring(2,10));
					doctorAdviceContent.find(".presupposeDateTimehms").html(doctorAdviceTemporaryItem.presupposeDateTime.substring(11,16));
					doctorAdviceContent.find(".doctorAdviceContent").html(doctorAdviceTemporaryItem.doctorAdviceContent);
					doctorAdviceContent.find(".doctorName").html(doctorAdviceTemporaryItem.doctorName);
					doctorAdviceContent.find(".nurseName").html(doctorAdviceTemporaryItem.nurseName);
					doctorAdviceContent.find(".executionDateTime").html(doctorAdviceTemporaryItem.executionDateTime.substring(12,16));
					doctorAdviceTemporaryTable.find("tbody").append(doctorAdviceContent);
				}
				
				$("#doctorAdviceTemporaryInfo").append(doctorAdviceTemporaryModel);
			}
			
		}
	}
	
	//长期医嘱单
	function doctorAdviceStandingInfo(data){
		//console.log(data);
		var doctorAdviceStandingRecords=data.doctorAdviceStandingRecords;
		var num=0;
		for(var index in doctorAdviceStandingRecords){
			var listLength=doctorAdviceStandingRecords[index].doctorAdviceStandingItems.length;//获取数据条数
			var pageNum=Math.ceil(listLength/20);//获取页数
			var numBer=0;//数组下标值
			if(pageNum>1){//如果数据条数大于1页就进行分页操作
				for (var int = 0; int < pageNum; int++) {//循环页数
					num++;
					var doctorAdviceStandingRecord=doctorAdviceStandingRecords[index];
					var longTermDoctorListModel=$("#longTermDoctorListModel").clone();
					longTermDoctorListModel.removeAttr("id");
					longTermDoctorListModel.removeAttr("hidden");
					//基础信息
					longTermDoctorListModel.find(".patientName").html(doctorAdviceStandingRecord.patientName);
					longTermDoctorListModel.find(".deptName").html(doctorAdviceStandingRecord.deptName);
					longTermDoctorListModel.find(".bedName").html(doctorAdviceStandingRecord.bedName);
					longTermDoctorListModel.find(".patientId").html(doctorAdviceStandingRecord.patientId);
					longTermDoctorListModel.find(".mrId").html(doctorAdviceStandingRecord.mrId);
					longTermDoctorListModel.find(".indexNumber").html(num);
					//循环医嘱信息
					var doctorAdviceStandingItems=doctorAdviceStandingRecord.doctorAdviceStandingItems;
					var longTermDoctorListTableModel=longTermDoctorListModel.find("#longTermDoctorListTableModel");
					longTermDoctorListTableModel.removeAttr("id");
					for(var itemsIndex in doctorAdviceStandingItems){
						if(numBer==listLength){
							break;
						}
						var doctorAdviceStandingItem=doctorAdviceStandingItems[itemsIndex];
						var doctorListContent=longTermDoctorListTableModel.find("#doctorListContent").clone();
						doctorListContent.removeAttr("hidden");
						doctorListContent.removeAttr("id");
						if(doctorAdviceStandingItem.doctorAdviceStartDateTime=="" || doctorAdviceStandingItem.doctorAdviceStartDateTime==null || typeof doctorAdviceStandingItem.doctorAdviceStartDateTime==undefined){
							doctorListContent.find(".doctorAdviceStartDate").html("");
							doctorListContent.find(".doctorAdviceStartTime").html("");
						}else{
							doctorListContent.find(".doctorAdviceStartDate").html(doctorAdviceStandingItem.doctorAdviceStartDateTime.substring(2,10));
							doctorListContent.find(".doctorAdviceStartTime").html(doctorAdviceStandingItem.doctorAdviceStartDateTime.substring(11,16));
						}
						
						doctorListContent.find(".doctorAdviceContent").html(doctorAdviceStandingItem.doctorAdviceContent);
						doctorListContent.find(".doctorAdviceStartDoctorName").html(doctorAdviceStandingItem.doctorAdviceStartDoctorName);
						doctorListContent.find(".doctorAdviceStartNurseName").html(doctorAdviceStandingItem.doctorAdviceStartNurseName);
						if(doctorAdviceStandingItem.doctorAdviceEndDateTime=="" || doctorAdviceStandingItem.doctorAdviceEndDateTime==null || typeof doctorAdviceStandingItem.doctorAdviceEndDateTime==undefined){
							doctorListContent.find(".doctorAdviceEndDate").html("");
							doctorListContent.find(".doctorAdviceEndTime").html("");
						}else{
							doctorListContent.find(".doctorAdviceEndDate").html(doctorAdviceStandingItem.doctorAdviceEndDateTime.substring(5,10));
							doctorListContent.find(".doctorAdviceEndTime").html(doctorAdviceStandingItem.doctorAdviceEndDateTime.substring(11,16));
						}
						
						doctorListContent.find(".doctorAdviceEndDoctorName").html(doctorAdviceStandingItem.doctorAdviceEndDoctorName);
						doctorListContent.find(".doctorAdviceEndNurseName").html(doctorAdviceStandingItem.doctorAdviceEndNurseName);
						longTermDoctorListTableModel.find("#longTermDoctorListTbody").append(doctorListContent);
						numBer++;
						if(numBer%20==0){//当下标值达到20的倍数会自动分到下一页
							break;
						}
					}
					
					$("#longTermDoctorList").append(longTermDoctorListModel);
				}
			}else{
				num++;
				var doctorAdviceStandingRecord=doctorAdviceStandingRecords[index];
				var longTermDoctorListModel=$("#longTermDoctorListModel").clone();
				longTermDoctorListModel.removeAttr("id");
				longTermDoctorListModel.removeAttr("hidden");
				//基础信息
				longTermDoctorListModel.find(".patientName").html(doctorAdviceStandingRecord.patientName);
				longTermDoctorListModel.find(".deptName").html(doctorAdviceStandingRecord.deptName);
				longTermDoctorListModel.find(".bedName").html(doctorAdviceStandingRecord.bedName);
				longTermDoctorListModel.find(".patientId").html(doctorAdviceStandingRecord.patientId);
				longTermDoctorListModel.find(".mrId").html(doctorAdviceStandingRecord.mrId);
				longTermDoctorListModel.find(".indexNumber").html(num);
				//循环医嘱信息
				var doctorAdviceStandingItems=doctorAdviceStandingRecord.doctorAdviceStandingItems;
				var longTermDoctorListTableModel=longTermDoctorListModel.find("#longTermDoctorListTableModel");
				longTermDoctorListTableModel.removeAttr("id");
				for(var itemsIndex in doctorAdviceStandingItems){
					var doctorAdviceStandingItem=doctorAdviceStandingItems[itemsIndex];
					var doctorListContent=longTermDoctorListTableModel.find("#doctorListContent").clone();
					doctorListContent.removeAttr("hidden");
					doctorListContent.removeAttr("id");
					if(doctorAdviceStandingItem.doctorAdviceStartDateTime=="" || doctorAdviceStandingItem.doctorAdviceStartDateTime==null || typeof doctorAdviceStandingItem.doctorAdviceStartDateTime==undefined){
						doctorListContent.find(".doctorAdviceStartDate").html("");
						doctorListContent.find(".doctorAdviceStartTime").html("");
					}else{
						doctorListContent.find(".doctorAdviceStartDate").html(doctorAdviceStandingItem.doctorAdviceStartDateTime.substring(2,10));
						doctorListContent.find(".doctorAdviceStartTime").html(doctorAdviceStandingItem.doctorAdviceStartDateTime.substring(11,16));
					}
					
					doctorListContent.find(".doctorAdviceContent").html(doctorAdviceStandingItem.doctorAdviceContent);
					doctorListContent.find(".doctorAdviceStartDoctorName").html(doctorAdviceStandingItem.doctorAdviceStartDoctorName);
					doctorListContent.find(".doctorAdviceStartNurseName").html(doctorAdviceStandingItem.doctorAdviceStartNurseName);
					if(doctorAdviceStandingItem.doctorAdviceEndDateTime=="" || doctorAdviceStandingItem.doctorAdviceEndDateTime==null || typeof doctorAdviceStandingItem.doctorAdviceEndDateTime==undefined){
						doctorListContent.find(".doctorAdviceEndDate").html("");
						doctorListContent.find(".doctorAdviceEndTime").html("");
					}else{
						doctorListContent.find(".doctorAdviceEndDate").html(doctorAdviceStandingItem.doctorAdviceEndDateTime.substring(5,10));
						doctorListContent.find(".doctorAdviceEndTime").html(doctorAdviceStandingItem.doctorAdviceEndDateTime.substring(11,16));
					}
					
					doctorListContent.find(".doctorAdviceEndDoctorName").html(doctorAdviceStandingItem.doctorAdviceEndDoctorName);
					doctorListContent.find(".doctorAdviceEndNurseName").html(doctorAdviceStandingItem.doctorAdviceEndNurseName);
					longTermDoctorListTableModel.find("#longTermDoctorListTbody").append(doctorListContent);
				}	
				$("#longTermDoctorList").append(longTermDoctorListModel);
			}	
		}
	}
